<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>脸云 - 签到系统</title>
		<link rel="stylesheet" href="../css/style.default.css" type="text/css" />
		<script type="text/javascript" src="../js/plugins/jquery-1.7.min.js"></script>
		<script type="text/javascript" src="../js/plugins/jquery-ui-1.8.16.custom.min.js"></script>
		<script type="text/javascript" src="../js/plugins/jquery.cookie.js"></script>
		<script type="text/javascript" src="../js/plugins/jquery.uniform.min.js"></script>
		<script type="text/javascript" src="../js/plugins/jquery.validate.min.js"></script>
		<script type="text/javascript" src="../js/plugins/jquery.tagsinput.min.js"></script>
		<script type="text/javascript" src="../js/plugins/charCount.js"></script>
		<script type="text/javascript" src="../js/plugins/ui.spinner.min.js"></script>
		<script type="text/javascript" src="../js/plugins/chosen.jquery.min.js"></script>
		<script type="text/javascript" src="../js/custom/general.js"></script>
		<script type="text/javascript" src="../js/custom/forms.js"></script>
		<script src="../js/baseServerLink.js" type="text/javascript" charset="utf-8"></script>

		<!--[if IE 9]>
    <link rel="stylesheet" media="screen" href="css/style.ie9.css"/>
<![endif]-->
		<!--[if IE 8]>
    <link rel="stylesheet" media="screen" href="css/style.ie8.css"/>
<![endif]-->
		<!--[if lt IE 9]>
	<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
<![endif]-->

		<!-- 圆角绿色小按钮！ -->
		<style type="text/css">
			.my_green_button {
				background-color: #95f04b;
				border: 0;
				border-radius: 20px;
				-moz-border-radius: 20px;
				/* 老的 Firefox */
				font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
				font-weight: bold;
				color: #5c8f30;
				border: 1px solid #6eac3a;
			}
			.my_green_button:hover{
				background-color: #92e747;
			}
		</style>

		<script type="text/javascript">
			// 将页面切换至操作面板
			function toPage2(id) {
				jQuery('#page2').click();
				jQuery('#page2iframe').attr('src', 'jumpToServlet?mode=ciuser&id=' + id);
			}
			
			function toPage2src(src) {
				jQuery('#page2').click();
				jQuery('#page2iframe').attr('src', src);
			}

			function addLine(id, username, email, app_num, type, available) {
				/*
				<tr>
					<td> 李四 </td>
					<td>789@qq.com</td>
					<td>8</td>
					<td>9</td>
					<td><a href="#" class="btn btn2 btn_archive"><span>操作</span></a></td>
				</tr>
				*/
				//展示信息的行
				$tr = jQuery("<tr class=\"vartr\"></tr>");
				$tr.append(jQuery("<td>" + username + "</td>"));
				$tr.append(jQuery("<td>" + email + "</td>"));
				$tr.append(jQuery("<td>" + app_num + "</td>"));
				
				//被禁用
				if(available == 0){
					type = "<s>"+"(用户被禁用)"+"</s>";
				}
				//正常
				else{
					if (type == '1') {
						type = '<b style="color:red"> 系统管理员 </b>'
					}
					else if (type == '2') {
						type = '<b style="color:blue"> 实验室负责人 </b>'
					}
					else {
						type = '<b style="color:green"> 标准用户 </b>'
					}
				}
				
				
				

				$tr.append(jQuery("<td>" + type + "</td>"));

				$opi = jQuery('<a id="aid_' + id + '" class="btn btn2 btn_archive" style="width: 75px;"><span>操作</span></a>');
				$opi.click(function() {
					eval("jQuery('#userid_'+id).show();");
				})
				$tr.append(jQuery("<td></td>").append($opi));

				//详细信息的行
				$frametr = jQuery("<tr class=\"vartr\"></tr>");
				//设置此行id,用于隐藏和显示
				$frametr.attr("id", "userid_" + id);
				$frametr.hide();
				$closeButton = jQuery("<button>关闭</buttton>");
				$closeButton.click(function() {
					eval("jQuery('#userid_'+id).hide();");
				})
				//加入关闭按钮
				$frametr.append(jQuery("<td></td>").append($closeButton));

				//拓展界面的内容

				$iframe = jQuery('<div style="height: 70px;width:100%; text-align: center;"></div>');
				$btn_jmp = jQuery('<br/><button  class="stdbtn btn_orange">修改此用户信息</button>');
				$btn_jmp.click(function() {
					toPage2("" + id);
				})
				$iframe.append($btn_jmp);
				//加入iframe
				$frametr.append(jQuery("<td colspan='4'></td>").append($iframe));

				jQuery("#my_tbody").append($tr);
				jQuery("#my_tbody").append($frametr);
			}


			function load_all_users() {
				//////////////////////////////////////debug//////////////////////////////////

				//////////////////////////////////////debug//////////////////////////////////
				$vartr = jQuery(".vartr");
				for (var i = 0; i < $vartr.length; i++) {
					$vartr.remove();
				}
				console.log("66");
				jQuery.ajax({
					url: '../CiuserServlet',
					data: {
						'mode': 43
					},

					success: function(message) {
						console.log(message);
						// alert(message);
						if (message[0] != '[') {
							window.location.href = "../index.jsp";
						} else {
							eval("message=" + message);

							jQuery("#id_user_num").text("共查询到 " + message.length + " 条记录");
							var d = new Date();
							jQuery('#reload_date').text(""+d);
							
							for (line in message) {
								my_line = message[line];
								addLine(
									my_line['id'],
									my_line['sid'],
									my_line['name'],
									my_line['email'],
									my_line['type'],
									my_line['is_available']
								);
							}
						}
					},
					error: function(message) {
						console.log(message)
					}
				})
			}

			jQuery(function() {
				load_all_users();
			})
		</script>

	</head>

	<body class="withvernav">

		<div class="bodywrapper">
			<iframe style="background-color: #485b79;" src="top.jsp" width="100%" height="160px"></iframe>
			<!--header-->

			<div class="vernav2 iconmenu">
				<ul>
					<li><a href="#formsub" class="editor">帮助手册</a>
						<!-- <span class="arrow"></span>
						<ul id="formsub">
							<li class="current"><a href="forms.html">系统概览</a></li>
						</ul> -->
					</li>

				</ul>
				<a class="togglemenu"> </a>
				<br /><br />
			</div>
			<!--leftmenu-->
<div class="centercontent">
	<iframe src="page_query_user.html" width="100%" height="1920px"style="border: 0;"></iframe>
</div>
			
		</div>
		<!--bodywrapper-->

	</body>
</html>
